<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Commodity extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->database();
// 		$this->load->model('commodity/commodity_model');
	}

// 	public function index(){
// 		$this->search();
// 	}

// 	public function search(){
// 		$this->load->view('common/header');
// 		$list = $this->commodity_model->searchList();
// 		$this->load->view('commodity/list1', array('list'=>$list));
// 		$this->load->view('common/footer');
// 	}

// 	public function detail($sku_code){
// 		$this->load->view('common/header');
// 		$detail = $this->commodity_model->search_detail($sku_code);
// 		$this->load->view('commodity/detail', array('detail'=>$detail));
// 		$this->load->view('common/footer');
// 	}

	public function index() {

// 		$this->load->database();
		$this->load->model("commodity_model");
		$data = $this->commodity_model->gets();
		// 		foreach($data as $entry) {
		// // 			var_dump($entry->id);
		// 			var_dump($entry);
		// 		}
// 		$this->load->view('head');
		$this->load->view('commodity/commodity', array('rs' => $data));
// 		$this->load->view('foot');
	}

	public function  get($comodity_code){
// 		$this->load->database();
		$this->load->model("commodity_model");
		$data = $this->commodity_model->get($comodity_code);
// 		$this->load->view('head');
		// 		$data = array('sku_code'=>$sku_code);
		// 		$this->load->view('get',$commodity_data);
		$this->load->view('commodity/commodity_detail',array('rs'=>$data));
// 		$this->load->view('foot');
	}

	public function  get_detail($comodity_code){
// 		$this->load->database();
		$this->load->model("commodity_model");
		$data = $this->commodity_model->get($comodity_code);
// 		$this->load->view('head');
		// 		$data = array('sku_code'=>$sku_code);
		// 		$this->load->view('get',$commodity_data);
		$this->load->view('commodity_detail2',array('rs'=>$data));
// 		$this->load->view('foot');
	}

	public function  bootstrap(){
		$this->load->view('bootstrap');
	}

}

